package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Mobile string `gorm:"type:char(11);not null;comment:手机号"`
}
type RealName struct {
	gorm.Model
	UserId   int    `gorm:"type:int(11);not null;comment:用户ID"`
	RealName string `gorm:"type:varchar(30);not null;comment:真实姓名"`
	IdCard   string `gorm:"type:varchar(50);not null;comment:身份证号"`
}

func (u *User) FindMobile() error {
	return DB.Debug().Where("mobile = ?", u.Mobile).Find(&u).Error
}
func (u *User) MobileCreate() error {
	return DB.Debug().Create(&u).Error
}
func (r *RealName) FindUserId() error {
	return DB.Debug().Where("user_id = ?", r.UserId).Find(&r).Error
}
func (r *RealName) RealNameCreate() error {
	return DB.Debug().Create(&r).Error
}
